//
//  MainView.swift
//  skincare
//
//  Created by whu125 on 2023/4/24.
//

import SwiftUI

struct MainView: View {
    @State private var selection = 0
    enum Tab {
            case index
            case camera
            case home
        }
        
        init() {
            UITabBar.appearance().backgroundColor = .systemGray6 //设置背景色，否则背景色为透明颜色
        }
   
    
    var body: some View {
        NavigationView {
            TabView(selection: $selection) {
                IndexView()
                    .tabItem {
                        Image(systemName: "globe.central.south.asia")
                        Text("首页")
                    }
                    .tag(Tab.index)
                
                CameraView()
                    .tabItem {
                        Image(systemName: "camera")
                        Text("测肤")
                    }
                    .tag(Tab.camera)
                
                HomeView()
                    .tabItem {
                        Image(systemName: "house")
                        Text("房屋")
                    }
                    .tag(Tab.home)
            }.accentColor(.green)
            
            
        }
    }
}


struct MainView_Previews: PreviewProvider {
    static var previews: some View {
        MainView()
    }
}
